package com.supermap.localization.impl;

import java.util.List;
import java.util.Map;

import com.supermap.localization.api.SampleComponent;
import com.supermap.localization.commontypes.SampleInfo;
import com.supermap.localization.database.LocalizationDao;

public class DatabaseSampleComponent implements SampleComponent {

    private LocalizationDao localizationDao;

    public void setLocalizationDao(LocalizationDao localizationDao) {
        this.localizationDao = localizationDao;
    }

    @Override
    public void saveSample(List<SampleInfo> infos) {
        for (int i = 0; i < infos.size(); i++) {
            localizationDao.insertSample(infos.get(i));
        }
    }

    @Override
    public Map<String, SampleInfo> readSampleInfos(String path) {
        return null;
    }

    @Override
    public List<SampleInfo> readSampleTranslate(String path) {
        return localizationDao.selectTranslate();
    }

    @Override
    public void saveSampleTranslate(List<SampleInfo> sampleInfos) {
        for (int i = 0; i < sampleInfos.size(); i++) {
            localizationDao.insertTranslate(sampleInfos.get(i));
        }
    }

}
